const merge = require("webpack-merge");
const common = require("./webpack.common.js");
const UglifyJSPlugin = require("uglifyjs-webpack-plugin");
const CleanCSSPlugin = require("less-plugin-clean-css");


module.exports = merge(common, {
    mode: "production",
    plugins: [
    	new UglifyJSPlugin()
    ],
    module: {
    	rules: [
            {
        		test: /\.less$/,
        		use: [
        			"style-loader",
        			"css-loader",
        			{
        				loader: "less-loader",
        				options: {
        					plugins: [
        						new CleanCSSPlugin({advanced: true})
        					]
        				}
        			}
        		]
            }
    	]
    }
});
